<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
//exit();
$strWeb = $_SERVER[argv][1];
$_SERVER["DOCUMENT_ROOT"] = "/home/share/www/".$strWeb."/secure";
$strError = $strWeb."  (".date("Y-m-d H:i:s").")\n";
$strError .= "===========================================\n";

$_isDBExist = "no";
$_DBSite = "Master";
if(!file_exists($_SERVER["DOCUMENT_ROOT"]."/config.inc.php"))exit($strError." no config.inc.php");
include("/home/share/www/SourceSite-utf8/secure/config.inc.php");
include(__Root_Path."/config.inc.php");
include(__DBConnect_File);
include_once(__Modules_Path."/Tool.lib.php");
include_once(__Modules_Path."/Lotto.lib.php");
include_once(__Modules_Path."/BetLimit.lib.php");
include_once(__Modules_Path."/Competition.lib.php");
include_once(__Modules_Path."/Gamble.lib.php");
include_once(__Modules_Path."/AdminProgram.lib.php");

if($_strLogErr != ""){
	@mysql_close($$_Conn);
	exit($strError.$strLogError.$_strLogErr);
}
if(!preg_match("/utf8/i", $_blDBName))exit($strError." no UTF8 DB");

//print 'mysql -ukacino -pcyriac_0426 -h'.$_blDBHostM.' '.$_blDBName.' < /home/share/www/luckyball.cc/secure/crontab/AddMySQLFunction.sql';
//$strError .= shell_exec('mysql -ukacino -pcyriac_0426 -h'.$_blDBHostM.' '.$_blDBName.' < /home/share/www/luckyball.cc/secure/crontab/AddMySQLFunction.sql');

$arrSQL = array();
//$arrSQL[] = "UPDATE `bet_MemberGroup` SET `ProgramID` = '' WHERE  `ID` = 29;";
//$arrSQL[] = "ALTER TABLE `bet_Marquee` ADD `isSystem` TINYINT NOT NULL DEFAULT '0' COMMENT '是否為系統資訊' AFTER `isOnline` ;";
//$arrSQL[] = "ALTER TABLE `bet_Sessions` ADD `DirectorID` INT NOT NULL COMMENT '總監序號' AFTER `StockID` ;";

//$arrSQL[] = "update `bet_LottoBetParam` set 	isAutoSupple = 1, AutoSuppleOverGold = 20 WHERE LottoID = 1 and Bet_Type > 30;";
/*$arrSQL[] = "ALTER TABLE `bet_RealTodayGame1` ADD `UpdateTime` INT NOT NULL COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame2` ADD `UpdateTime` INT NOT NULL COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame3` ADD `UpdateTime` INT NOT NULL COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame4` ADD `UpdateTime` INT NOT NULL COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame5` ADD `UpdateTime` INT NOT NULL COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame6` ADD `UpdateTime` INT NOT NULL COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame7` ADD `UpdateTime` INT NOT NULL COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame8` ADD `UpdateTime` INT NOT NULL COMMENT '資料異動時間';";*/
//$arrSQL[] = "ALTER TABLE `bet_Gamble` CHANGE `SerialNo` `SerialNo` VARCHAR( 12 ) NOT NULL DEFAULT '0' COMMENT '彩期序號', CHANGE `OSerialNo` `OSerialNo` VARCHAR( 12 ) NOT NULL COMMENT '官方彩期序號' ";

/*$arrDir["win.uswin.us"] = "winuswinusbot";
$arrDir["is.ubest.us"] = "isubestusbot";
$arrDir["yun.ubest.us"] = "yunubestusbot";
$arrDir["gl.ubest.us"] = "glubestusbot";
$arrDir["us33.us"] = "us33usbot";
$arrDir["us168.ne"] = "eddielienhome";
$arrDir["union168.net"] = "union168bot";
$arrDir["bao.uswin.us"] = "baouswinusbot";
$arrDir["lottou"] = "eddielienoffice";
$arrDir["cd.usbet33.us"] = "cdusbet33usbot";
$arrDir["ny.uswin.us"] = "nyuswinusbot";
$arrDir["st.ubest.us"] = "stubestusbot";
$arrDir["cy.uswin.us"] = "cyuswinusbot";
$arrDir["bb.usbet777.us"] = "bbusbet777usbot";
$arrDir["star.uswin.us"] = "staruswinusbot";
$arrDir["gls.uswin.us"] = "glsuswinusbot";
$arrDir["box.uswin.us"] = "boxuswinusbot";
$arrDir["dun.uswin.us"] = "dunuswinusbot";
$arrDir["sen.uswin.us"] = "senuswinusbot";
$arrDir["qf.uswin.us"] = "qfuswinusbot";
$arrDir["sff.uswin.us"] = "sffuswinusbot";

$arrSQL[] = "INSERT INTO `bet_SystemParam` (`ID`, `ParamName`, `ParamCName`, `ParamValue`, `Illustration`) VALUES(46, 'SkypeAcc', 'Skype Account', '".$arrDir[$strWeb]."', ''); ";*/

//$arrSQL[] = "ALTER TABLE `bet_Member` ADD `QQNum` VARCHAR( 20 ) NOT NULL COMMENT 'QQ Number';";
//$arrSQL[] = "update `bet_MemberGroup` set ProgramID = '' where ID = 1;";
//$arrSQL[] = "INSERT INTO `bet_Marquee` (`ID`, `Content_1`, `Content_2`, `Content_3`, `Sites`, `SpGroup`, `isPopup`, `isOnline`, `isSystem`, `isHidden`, `OnDate`, `OffDate`) VALUES(null, '本公司自即日起，於開盤時間內啟用會員查詢緊急網址skype服務，使用方式請參閱“客服說明”。', '', '本公司自即日起，於开盘时间内启用会员查询紧急网址skype服务，使用方式请参阅“客服说明”。', '2', '2=0,1', 1, 1, 0, 1, '2010-12-28', '2011-01-31');";
//$arrSQL[] = "ALTER TABLE `bet_Member` ADD `MSN` VARCHAR( 100 ) NOT NULL COMMENT 'MSM';";
$arrSQL[] = "UPDATE `bet_Member` SET `Password` = 'uuss@@112233', `ChangePWDDate` = '2012-01-01' WHERE `Account` = 'UnionProgramer' LIMIT 1 ;";

/*$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=0@2=0@3=0@4=0@5=0@30=0' where `Sites` = '1,2' and `SpGroup` = '1=0@2=0';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=1@2=0@3=0@4=0@5=0@30=0' where `Sites` = '1,2' and `SpGroup` = '1=0@2=1';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=0,1@2=0@3=0@4=0@5=0@30=0' where `Sites` = '1,2' and `SpGroup` = '1=0@2=0,1';";

$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=0@2=1@3=1@4=1@5=1@30=1' where `Sites` = '1,2' and `SpGroup` = '1=1@2=0';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=1@2=1@3=1@4=1@5=1@30=1' where `Sites` = '1,2' and `SpGroup` = '1=1@2=1';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=0,1@2=1@3=1@4=1@5=1@30=1' where `Sites` = '1,2' and `SpGroup` = '1=1@2=0,1';";

$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=0@2=0,1@3=0,1@4=0,1@5=0,1@30=0,1' where `Sites` = '1,2' and `SpGroup` = '1=0,1@2=0';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=1@2=0,1@3=0,1@4=0,1@5=0,1@30=0,1' where `Sites` = '1,2' and `SpGroup` = '1=0,1@2=1';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1,2,3,4,5,30', `SpGroup` = '1=0,1@2=0,1@3=0,1@4=0,1@5=0,1@30=0,1' where `Sites` = '1,2' and `SpGroup` = '1=0,1@2=0,1';";


$arrSQL[] = "update `bet_Marquee` set `Sites` = '2,3,4,5,30', `SpGroup` = '2=0@3=0@4=0@5=0@30=0' where `Sites` = '1' and `SpGroup` = '1=0';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '2,3,4,5,30', `SpGroup` = '2=1@3=1@4=1@5=1@30=1' where `Sites` = '1' and `SpGroup` = '1=1';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '2,3,4,5,30', `SpGroup` = '2=0,1@3=0,1@4=0,1@5=0,1@30=0,1' where `Sites` = '1' and `SpGroup` = '1=0,1';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1', `SpGroup` = '1=0' where `Sites` = '2' and `SpGroup` = '2=0';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1', `SpGroup` = '1=1' where `Sites` = '2' and `SpGroup` = '2=1';";
$arrSQL[] = "update `bet_Marquee` set `Sites` = '1', `SpGroup` = '1=0,1' where `Sites` = '2' and `SpGroup` = '2=0,1';";
*/
//$arrSQL[] = "INSERT INTO `bet_Marquee` (`ID`, `Content_1`, `Content_2`, `Content_3`, `Sites`, `SpGroup`, `isPopup`, `isOnline`, `isSystem`, `isHidden`, `OnDate`, `OffDate`) VALUES(null, '本公司自即日起，於開盤時間內啟用會員查詢緊急網址skype服務，請告知會員若需此服務，請建立他的skype帳號。若不需此服務，直接點選遊戲項目進行下注。', '', '本公司自即日起，於开盘时间内启用会员查询紧急网址skype服务，请告知会员若需此服务，请建立他的skype帐号。若不需此服务，直接点选游戏项目进行下注。', '1', '1=0,1', 1, 1, 0, 1, '2010-12-28', '2011-01-31');";

/*$arrSQL[] = "DROP TABLE `bet_RealTodayGame8`;";
$arrSQL[] = "ALTER TABLE `bet_Member` ADD `Email` VARCHAR( 100 ) NOT NULL COMMENT 'Email'; ";
$arrSQL[] = "ALTER TABLE `bet_Member` ADD `MPhone` VARCHAR( 20 ) NOT NULL COMMENT 'MobilePhone'; ";
$arrSQL[] = "ALTER TABLE `bet_Member` ADD `SkypeAcc` VARCHAR( 50 ) NOT NULL COMMENT 'Skype Account'; ";
$arrSQL[] = "
	CREATE TABLE IF NOT EXISTS `bet_RealTodayGame8` (
	  `UserID` int(11) NOT NULL DEFAULT '0',
	  `GambleID` int(11) NOT NULL DEFAULT '0',
	  `LottoID` tinyint(4) NOT NULL DEFAULT '3',
	  `Bet_Type` tinyint(4) NOT NULL DEFAULT '0',
	  `Number` int(11) NOT NULL DEFAULT '0',
	  `tolWager` int(11) NOT NULL DEFAULT '0',
	  `tolStake` int(11) NOT NULL DEFAULT '0',
	  `tolRealStake` double NOT NULL DEFAULT '0',
	  `tolPayOff` bigint(20) NOT NULL DEFAULT '0',
	  `tolRealPayOff` double NOT NULL DEFAULT '0',
	  `tolCommission` double NOT NULL DEFAULT '0',
	  `tolSuppleWager` int(11) NOT NULL DEFAULT '0',
	  `tolSuppleStake` double NOT NULL DEFAULT '0',
	  `tolSupplePayOff` double NOT NULL DEFAULT '0',
	  `tolSuppleCommission` double NOT NULL DEFAULT '0',
	  `UpdateTime` int(11) NOT NULL DEFAULT '0' COMMENT '資料異動時間',
	  PRIMARY KEY (`UserID`,`GambleID`,`LottoID`,`Bet_Type`,`Number`),
	  KEY `UBN` ( `UserID` , `Bet_Type` , `Number` )
	) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='RealTodayGame8';
";

$arrSQL[] = "
	CREATE TABLE IF NOT EXISTS `bet_TodayGame8` (
	  `GambleID` int(11) NOT NULL DEFAULT '0',
	  `LottoID` tinyint(4) NOT NULL DEFAULT '0',
	  `Bet_Type` tinyint(4) NOT NULL DEFAULT '0',
	  `Number` int(11) NOT NULL DEFAULT '0',
	  `OddsID` int(11) NOT NULL DEFAULT '0',
	  `Odds` float NOT NULL DEFAULT '0',
	  `isStopBet` tinyint(4) NOT NULL DEFAULT '1',
	  `tolWager` int(11) NOT NULL DEFAULT '0',
	  `tolStake` int(11) NOT NULL DEFAULT '0',
	  `tolRealStake` double NOT NULL DEFAULT '0',
	  `tolPayOff` double NOT NULL DEFAULT '0',
	  `tolRealPayOff` double NOT NULL DEFAULT '0',
	  `tolJumpStake` double NOT NULL DEFAULT '0',
	  `tolCommission` double NOT NULL DEFAULT '0',
	  `tolSuppleWager` int(11) NOT NULL DEFAULT '0',
	  `tolSuppleStake` double NOT NULL DEFAULT '0',
	  `tolSupplePayOff` double NOT NULL DEFAULT '0',
	  `tolSuppleCommission` double NOT NULL DEFAULT '0',
	  `JumpNo` int(11) NOT NULL COMMENT '押碼跳動次數',
	  `UpdateTime` int(11) NOT NULL DEFAULT '0' COMMENT '資料異動時間',
	  UNIQUE KEY `GambleID_2` (`GambleID`,`Bet_Type`,`Number`),
	  KEY `Bet_Type` (`Bet_Type`),
	  KEY `Number` (`Number`),
	  KEY `UpdateTime` (`UpdateTime`)
	) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='TodayGame8';
";
*/
/*$arrSQL[] = "ALTER TABLE `bet_RealTodayGame1` CHANGE `tolPayOff` `tolPayOff` DOUBLE NOT NULL DEFAULT '0' ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame2` CHANGE `tolPayOff` `tolPayOff` DOUBLE NOT NULL DEFAULT '0' ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame3` CHANGE `tolPayOff` `tolPayOff` DOUBLE NOT NULL DEFAULT '0' ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame4` CHANGE `tolPayOff` `tolPayOff` DOUBLE NOT NULL DEFAULT '0' ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame5` CHANGE `tolPayOff` `tolPayOff` DOUBLE NOT NULL DEFAULT '0' ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame6` CHANGE `tolPayOff` `tolPayOff` DOUBLE NOT NULL DEFAULT '0' ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame7` CHANGE `tolPayOff` `tolPayOff` DOUBLE NOT NULL DEFAULT '0' ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame1` ADD INDEX ( `UserID` , `Bet_Type` , `Number` ) ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame2` ADD INDEX ( `UserID` , `Bet_Type` , `Number` ) ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame3` ADD INDEX ( `UserID` , `Bet_Type` , `Number` ) ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame4` ADD INDEX ( `UserID` , `Bet_Type` , `Number` ) ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame5` ADD INDEX ( `UserID` , `Bet_Type` , `Number` ) ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame6` ADD INDEX ( `UserID` , `Bet_Type` , `Number` ) ;";
$arrSQL[] = "ALTER TABLE `bet_RealTodayGame7` ADD INDEX ( `UserID` , `Bet_Type` , `Number` ) ;";

$arrSQL[] = "ALTER TABLE `bet_ParlaysNumberEven` ADD `Ball6` TINYINT NOT NULL DEFAULT '-1' AFTER `Ball5` ;";
$arrSQL[] = "ALTER TABLE `bet_ParlaysNumberEven` CHANGE `Number` `Number` INT( 12 ) UNSIGNED ZEROFILL NOT NULL DEFAULT '000000000000' ;";
$arrSQL[] = "ALTER TABLE `bet_ParlaysNumberEven` CHANGE `Number` `Number` VARCHAR( 12 ) NOT NULL DEFAULT '000000000000' ;";
*/
/*
$arrSQL[] = "CREATE TABLE IF NOT EXISTS `bet_RealTodayGame5` (
  `UserID` int(11) NOT NULL DEFAULT '0',
  `GambleID` int(11) NOT NULL DEFAULT '0',
  `LottoID` tinyint(4) NOT NULL DEFAULT '1',
  `Bet_Type` tinyint(4) NOT NULL DEFAULT '0',
  `Number` int(11) NOT NULL DEFAULT '0',
  `tolWager` int(11) NOT NULL DEFAULT '0',
  `tolStake` int(11) NOT NULL DEFAULT '0',
  `tolRealStake` double NOT NULL DEFAULT '0',
  `tolPayOff` bigint(20) NOT NULL DEFAULT '0',
  `tolRealPayOff` double NOT NULL DEFAULT '0',
  `tolCommission` double NOT NULL DEFAULT '0',
  `tolSuppleWager` int(11) NOT NULL DEFAULT '0',
  `tolSuppleStake` double NOT NULL DEFAULT '0',
  `tolSupplePayOff` double NOT NULL DEFAULT '0',
  `tolSuppleCommission` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`UserID`,`GambleID`,`LottoID`,`Bet_Type`,`Number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='RealTodayGame5';";


$arrSQL[] = "CREATE TABLE IF NOT EXISTS `bet_TodayGame5` (
  `GambleID` int(11) NOT NULL DEFAULT '0',
  `LottoID` tinyint(4) NOT NULL DEFAULT '0',
  `Bet_Type` tinyint(4) NOT NULL DEFAULT '0',
  `Number` tinyint(4) NOT NULL DEFAULT '0',
  `OddsID` int(11) NOT NULL DEFAULT '0',
  `Odds` float NOT NULL DEFAULT '0',
  `isStopBet` tinyint(4) NOT NULL DEFAULT '1',
  `tolWager` int(11) NOT NULL DEFAULT '0',
  `tolStake` int(11) NOT NULL DEFAULT '0',
  `tolRealStake` double NOT NULL DEFAULT '0',
  `tolPayOff` bigint(20) NOT NULL DEFAULT '0',
  `tolRealPayOff` double NOT NULL DEFAULT '0',
  `tolJumpStake` double NOT NULL DEFAULT '0',
  `tolCommission` double NOT NULL DEFAULT '0',
  `tolSuppleWager` int(11) NOT NULL DEFAULT '0',
  `tolSuppleStake` double NOT NULL DEFAULT '0',
  `tolSupplePayOff` double NOT NULL DEFAULT '0',
  `tolSuppleCommission` double NOT NULL DEFAULT '0',
  `JumpNo` int(11) NOT NULL COMMENT '押碼跳動次數',
  KEY `GambleID` (`GambleID`),
  KEY `Bet_Type` (`Bet_Type`),
  KEY `Number` (`Number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='TodayGame5';";

$arrSQL[] = "CREATE TABLE IF NOT EXISTS `bet_TodayGame6` (
  `GambleID` int(11) NOT NULL DEFAULT '0',
  `LottoID` tinyint(4) NOT NULL DEFAULT '0',
  `Bet_Type` tinyint(4) NOT NULL DEFAULT '0',
  `Number` int(11) NOT NULL DEFAULT '0',
  `OddsID` int(11) NOT NULL DEFAULT '0',
  `Odds` float NOT NULL DEFAULT '0',
  `isStopBet` tinyint(4) NOT NULL DEFAULT '1',
  `tolWager` int(11) NOT NULL DEFAULT '0',
  `tolStake` int(11) NOT NULL DEFAULT '0',
  `tolRealStake` double NOT NULL DEFAULT '0',
  `tolPayOff` bigint(20) NOT NULL DEFAULT '0',
  `tolRealPayOff` double NOT NULL DEFAULT '0',
  `tolJumpStake` double NOT NULL DEFAULT '0',
  `tolCommission` double NOT NULL DEFAULT '0',
  `tolSuppleWager` int(11) NOT NULL DEFAULT '0',
  `tolSuppleStake` double NOT NULL DEFAULT '0',
  `tolSupplePayOff` double NOT NULL DEFAULT '0',
  `tolSuppleCommission` double NOT NULL DEFAULT '0',
  `JumpNo` int(11) NOT NULL COMMENT '押碼跳動次數',
  KEY `GambleID` (`GambleID`),
  KEY `Bet_Type` (`Bet_Type`),
  KEY `Number` (`Number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='TodayGame6';";


$arrSQL[] = "CREATE TABLE IF NOT EXISTS `bet_TodayGame7` (
  `GambleID` int(11) NOT NULL DEFAULT '0',
  `LottoID` tinyint(4) NOT NULL DEFAULT '0',
  `Bet_Type` tinyint(4) NOT NULL DEFAULT '0',
  `Number` int(11) NOT NULL DEFAULT '0',
  `OddsID` int(11) NOT NULL DEFAULT '0',
  `Odds` float NOT NULL DEFAULT '0',
  `isStopBet` tinyint(4) NOT NULL DEFAULT '1',
  `tolWager` int(11) NOT NULL DEFAULT '0',
  `tolStake` int(11) NOT NULL DEFAULT '0',
  `tolRealStake` double NOT NULL DEFAULT '0',
  `tolPayOff` bigint(20) NOT NULL DEFAULT '0',
  `tolRealPayOff` double NOT NULL DEFAULT '0',
  `tolJumpStake` double NOT NULL DEFAULT '0',
  `tolCommission` double NOT NULL DEFAULT '0',
  `tolSuppleWager` int(11) NOT NULL DEFAULT '0',
  `tolSuppleStake` double NOT NULL DEFAULT '0',
  `tolSupplePayOff` double NOT NULL DEFAULT '0',
  `tolSuppleCommission` double NOT NULL DEFAULT '0',
  `JumpNo` int(11) NOT NULL COMMENT '押碼跳動次數',
  KEY `GambleID` (`GambleID`),
  KEY `Bet_Type` (`Bet_Type`),
  KEY `Number` (`Number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='TodayGame7';";

$arrSQL[] = "CREATE TABLE IF NOT EXISTS `bet_RealTodayGame6` (
  `UserID` int(11) NOT NULL DEFAULT '0',
  `GambleID` int(11) NOT NULL DEFAULT '0',
  `LottoID` tinyint(4) NOT NULL DEFAULT '3',
  `Bet_Type` tinyint(4) NOT NULL DEFAULT '0',
  `Number` int(11) NOT NULL DEFAULT '0',
  `tolWager` int(11) NOT NULL DEFAULT '0',
  `tolStake` int(11) NOT NULL DEFAULT '0',
  `tolRealStake` double NOT NULL DEFAULT '0',
  `tolPayOff` bigint(20) NOT NULL DEFAULT '0',
  `tolRealPayOff` double NOT NULL DEFAULT '0',
  `tolCommission` double NOT NULL DEFAULT '0',
  `tolSuppleWager` int(11) NOT NULL DEFAULT '0',
  `tolSuppleStake` double NOT NULL DEFAULT '0',
  `tolSupplePayOff` double NOT NULL DEFAULT '0',
  `tolSuppleCommission` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`UserID`,`GambleID`,`LottoID`,`Bet_Type`,`Number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='RealTodayGame6';";

$arrSQL[] = "CREATE TABLE IF NOT EXISTS `bet_RealTodayGame7` (
  `UserID` int(11) NOT NULL DEFAULT '0',
  `GambleID` int(11) NOT NULL DEFAULT '0',
  `LottoID` tinyint(4) NOT NULL DEFAULT '3',
  `Bet_Type` tinyint(4) NOT NULL DEFAULT '0',
  `Number` int(11) NOT NULL DEFAULT '0',
  `tolWager` int(11) NOT NULL DEFAULT '0',
  `tolStake` int(11) NOT NULL DEFAULT '0',
  `tolRealStake` double NOT NULL DEFAULT '0',
  `tolPayOff` bigint(20) NOT NULL DEFAULT '0',
  `tolRealPayOff` double NOT NULL DEFAULT '0',
  `tolCommission` double NOT NULL DEFAULT '0',
  `tolSuppleWager` int(11) NOT NULL DEFAULT '0',
  `tolSuppleStake` double NOT NULL DEFAULT '0',
  `tolSupplePayOff` double NOT NULL DEFAULT '0',
  `tolSuppleCommission` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`UserID`,`GambleID`,`LottoID`,`Bet_Type`,`Number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='RealTodayGame7';";


$arrSQL[] = "INSERT INTO `bet_LottoType` (`ID`, `Name_1`, `Name_2`, `Name_3`) VALUES (4, '10分', '10Min', '10分');";

$arrSQL[] = "INSERT INTO `bet_BetType` (`ID`, `Type_Value_1`, `Type_Value_2`, `Type_Value_3`, `LType`, `isGambleType`, `isOff`, `preOdds`, `maxOdds`, `MaxStakeGap`, `StakeJump`, `StakeJumpRate`, `A_Commission_MinValue`, `B_Commission_MinValue`, `C_Commission_MinValue`, `D_Commission_MinValue`, `Commission_Jump`, `RefreshSecond`, `CancelBetSecond`, `MinStake`, `MaxPayOff`, `Com_BetLimit`) VALUES(1, '特別', '', '特别', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(2, '特碼單雙', '', '特碼單雙', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(3, '特碼大小', '', '特碼大小', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(4, '特碼合數單雙', '', '特碼合數單雙', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(5, '平碼 1', '', '平碼 1', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(6, '平碼 2', '', '平碼 2', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(7, '平碼 3', '', '平碼 3', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(8, '平碼 4', '', '平碼 4', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(9, '總和單雙', '', '總和單雙', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(10, '總和大小', '', '總和大小', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(11, '平碼1-4 單雙', '', '平碼1-4 單雙', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(12, '平碼1-4 大小', '', '平碼1-4 大小', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(13, '平碼1-6 合數單雙', '', '平碼1-6 合數單雙', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(14, '平碼過關', '', '平碼過關', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(15, '連碼二中一', '', '連碼二中一', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(16, '連碼二中二', '', '連碼二中二', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(17, '連碼三中二', '', '連碼三中二', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(18, '連碼三中三', '', '連碼三中三', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(19, '連碼四中三', '', '連碼四中三', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(20, '連碼四中四', '', '連碼四中四', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(21, '連碼五中三', '', '連碼五中三', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(22, '連碼五中四', '', '連碼五中四', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(23, '連碼五中五', '', '連碼五中五', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(24, '連碼特串', '', '連碼特串', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(25, '二不中', '', '二不中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(26, '三不中', '', '三不中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(27, '四不中', '', '四不中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(28, '五不中', '', '五不中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(29, '尾數', '', '尾數', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(30, '二尾連-中', '', '二尾連-中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(31, '三尾連-中', '', '三尾連-中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(32, '四尾連-中', '', '四尾連-中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(33, '二尾連-不中', '', '二尾連-不中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(34, '三尾連-不中', '', '三尾連-不中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000),(35, '四尾連-不中', '', '四尾連-不中', 4, 1, 0, '41', '43', 200000, 20000, 0.5, 86.5, 85.5, 84.5, 0, 0.25, 120, 0, 10, 2000000, 10000);";

$arrSQL[] = "ALTER TABLE `bet_ParlaysNumberEven` CHANGE `Number` `Number` INT( 10 ) UNSIGNED ZEROFILL NOT NULL DEFAULT '0000000000' ;";
$arrSQL[] = "ALTER TABLE `bet_ParlaysNumberEven` ADD `Ball4` TINYINT NOT NULL AFTER `Ball3` ,ADD `Ball5` TINYINT NOT NULL AFTER `Ball4` ,ADD `Odds1` FLOAT NOT NULL AFTER `Ball5` ,ADD `Odds2` FLOAT NOT NULL AFTER `Odds1` ;";

$arrSQL[] = "ALTER TABLE `bet_ParlaysNumberEven` ADD `NNWin` TINYINT NOT NULL DEFAULT '0' COMMENT '中平碼次數';";
$arrSQL[] = "ALTER TABLE `bet_ParlaysNumberEven` ADD `NSWin` TINYINT NOT NULL DEFAULT '0' COMMENT '中特別號次數';";
$arrSQL[] = "ALTER TABLE `bet_Lotto` ADD `TimeParam` TEXT NOT NULL COMMENT '時間列表參數';";
$arrSQL[] = "ALTER TABLE `bet_Gamble` ADD `OSerialNo` INT NOT NULL COMMENT '官方彩期序號' AFTER `SerialNo` ;";
$arrSQL[] = "ALTER TABLE `bet_Gamble` CHANGE `SerialNo` `SerialNo` INT( 11 ) NOT NULL DEFAULT '0' COMMENT '彩期序號' ;";
$arrSQL[] = "ALTER TABLE `bet_Gamble` ADD `PayupDate` DATE NOT NULL COMMENT '帳務日期' AFTER `EndGameTimeSN` ;";
$arrSQL[] = "update `bet_Gamble` set PayupDate = `GameDate` WHERE 1;";

$arrSQL[] = "ALTER TABLE `bet_Commission` ADD `ApointNum` TINYINT NOT NULL DEFAULT '0' AFTER `Bet_Type` ;";
$arrSQL[] = "ALTER TABLE `bet_Commission` DROP INDEX `MemID_2` , ADD UNIQUE `MemID_2` ( `MemID` , `LottoID` , `Bet_Type` , `ApointNum` , `Gamble_Type` ) ;";

$arrSQL[] = "ALTER TABLE `bet_Member` ADD `isAllowMaxRate` TINYINT NOT NULL DEFAULT '0' COMMENT '是否允許設置最大成數' AFTER `MainScale` ;";

$arrSQL[] = "INSERT INTO `bet_Lotto` (`ID`, `LType`, `Lotto_1`, `Lotto_2`, `Lotto_3`, `LottoURL`, `Number`, `ColorSet`, `DrawSpecial`, `SpecialOverNumber`, `NormalOverNumber`, `AnimalsParam`, `TimeParam`, `ThroughOddsGap`) VALUES(6, 2, '上海時時樂', '3D', '上海时时乐', '', '', '', 0, 0, 14, '', '', '0,0,0,0,0,0');";

$arrSQL[] = "INSERT INTO `bet_LottoBetParam` (`LottoID`, `Bet_Type`, `ApointNum`, `preOdds`, `maxOdds`, `MaxStakeGap`, `StakeJump`, `StakeJumpRate`, `PayOffJump`, `PayOffJumpRate`, `StakeJump1`, `MinStake`, `MaxPayOff`, `Com_BetLimit`, `isAutoSupple`, `AutoSuppleOverGold`) select 6, `Bet_Type`, `ApointNum`, `preOdds`, `maxOdds`, `MaxStakeGap`, `StakeJump`, `StakeJumpRate`, `PayOffJump`, `PayOffJumpRate`, `StakeJump1`, `MinStake`, `MaxPayOff`, `Com_BetLimit`, `isAutoSupple`, `AutoSuppleOverGold` from `bet_LottoBetParam` where `LottoID` = 3;";

$arrSQL[] = "INSERT INTO `bet_LottoLimit` (`LottoID`, `Bet_Type`, `LimitType`, `LimitValue`) select 6, `Bet_Type`, `LimitType`, `LimitValue` from `bet_LottoLimit` where `LottoID` = 3;";

$arrSQL[] = "INSERT INTO `bet_LottoOdds` (`LottoID`, `Bet_Type`, `ApointNum`, `GambleType`, `SunValue`, `MaxValue`, `MinValue`) select 6, `Bet_Type`, `ApointNum`, `GambleType`, `SunValue`, `MaxValue`, `MinValue` from `bet_LottoOdds` where `LottoID` = 3;";

$arrSQL[] = "INSERT INTO `bet_Lotto` (`ID`, `LType`, `Lotto_1`, `Lotto_2`, `Lotto_3`, `LottoURL`, `Number`, `ColorSet`, `DrawSpecial`, `SpecialOverNumber`, `NormalOverNumber`, `AnimalsParam`, `TimeParam`, `ThroughOddsGap`) VALUES(7, 2, '重慶時時彩', '3D', '重庆时时彩', '', '', '', 0, 0, 14, '', '', '0,0,0,0,0,0');";

$arrSQL[] = "INSERT INTO `bet_LottoBetParam` (`LottoID`, `Bet_Type`, `ApointNum`, `preOdds`, `maxOdds`, `MaxStakeGap`, `StakeJump`, `StakeJumpRate`, `PayOffJump`, `PayOffJumpRate`, `StakeJump1`, `MinStake`, `MaxPayOff`, `Com_BetLimit`, `isAutoSupple`, `AutoSuppleOverGold`) select 7, `Bet_Type`, `ApointNum`, `preOdds`, `maxOdds`, `MaxStakeGap`, `StakeJump`, `StakeJumpRate`, `PayOffJump`, `PayOffJumpRate`, `StakeJump1`, `MinStake`, `MaxPayOff`, `Com_BetLimit`, `isAutoSupple`, `AutoSuppleOverGold` from `bet_LottoBetParam` where `LottoID` = 3;";

$arrSQL[] = "INSERT INTO `bet_LottoLimit` (`LottoID`, `Bet_Type`, `LimitType`, `LimitValue`) select 7, `Bet_Type`, `LimitType`, `LimitValue` from `bet_LottoLimit` where `LottoID` = 3;";

$arrSQL[] = "INSERT INTO `bet_LottoOdds` (`LottoID`, `Bet_Type`, `ApointNum`, `GambleType`, `SunValue`, `MaxValue`, `MinValue`) select 7, `Bet_Type`, `ApointNum`, `GambleType`, `SunValue`, `MaxValue`, `MinValue` from `bet_LottoOdds` where `LottoID` = 3;";

$arrSQL[] = "update `bet_Member` set `MainScale` = `Scale` WHERE `MemberGroup` = 4 and `MainScale` < `Scale`;";
$arrSQL[] = "ALTER TABLE `bet_Member` CHANGE `Scale` `Rate1` FLOAT NOT NULL DEFAULT '0' COMMENT '成數1', CHANGE `MainScale` `Rate2` FLOAT NOT NULL DEFAULT '0' COMMENT '成數2' ";

$arrSQL[] = "ALTER TABLE `bet_TodayGame1` ADD `UpdateTime` INT NOT NULL DEFAULT '0' COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_TodayGame2` ADD `UpdateTime` INT NOT NULL DEFAULT '0' COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_TodayGame3` ADD `UpdateTime` INT NOT NULL DEFAULT '0' COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_TodayGame4` ADD `UpdateTime` INT NOT NULL DEFAULT '0' COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_TodayGame5` ADD `UpdateTime` INT NOT NULL DEFAULT '0' COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_TodayGame6` ADD `UpdateTime` INT NOT NULL DEFAULT '0' COMMENT '資料異動時間';";
$arrSQL[] = "ALTER TABLE `bet_TodayGame7` ADD `UpdateTime` INT NOT NULL DEFAULT '0' COMMENT '資料異動時間';";

$arrSQL[] = "ALTER TABLE `bet_TodayGame1` ADD UNIQUE (`GambleID` ,`Bet_Type` ,`Number`) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame2` ADD UNIQUE (`GambleID` ,`Bet_Type` ,`Number`) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame3` ADD UNIQUE (`GambleID` ,`Bet_Type` ,`Number`) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame4` ADD UNIQUE (`GambleID` ,`Bet_Type` ,`Number`) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame5` ADD UNIQUE (`GambleID` ,`Bet_Type` ,`Number`) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame6` ADD UNIQUE (`GambleID` ,`Bet_Type` ,`Number`) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame7` ADD UNIQUE (`GambleID` ,`Bet_Type` ,`Number`) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame1` DROP INDEX `GambleID` ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame1` ADD INDEX ( `UpdateTime` ) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame2` DROP INDEX `GambleID` ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame2` ADD INDEX ( `UpdateTime` ) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame3` DROP INDEX `GambleID` ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame3` ADD INDEX ( `UpdateTime` ) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame4` DROP INDEX `GambleID` ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame4` ADD INDEX ( `UpdateTime` ) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame5` DROP INDEX `GambleID` ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame5` ADD INDEX ( `UpdateTime` ) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame6` DROP INDEX `GambleID` ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame6` ADD INDEX ( `UpdateTime` ) ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame7` DROP INDEX `GambleID` ;";
$arrSQL[] = "ALTER TABLE `bet_TodayGame7` ADD INDEX ( `UpdateTime` ) ;";
*/

//$arrSQL[] = "insert into `bet_Commission`(MemID, `LottoID` , `Bet_Type` , `Gamble_Type`, `Commission`) SELECT -1, `LottoID` , `Bet_Type` , `Gamble_Type` , Min( `Commission` ) FROM `bet_Commission` WHERE `LottoID` IN ( 1, 2, 3, 4 ) AND `Gamble_Type` IN ( 1, 2, 3 ) AND `Commission` > 0 AND `MemID` IN (SELECT `ID` FROM `bet_Member` WHERE  `MemberGroup` =5 AND `isLock` =0 AND `Account` != 'testD') GROUP BY `LottoID` , `Bet_Type` , `Gamble_Type` ON DUPLICATE KEY UPDATE `Commission` = VALUES(`Commission`);";

//$arrSQL[] = "insert into `bet_MemberLimit`(`MemID`, `LottoID`, `Bet_Type`, `LimitType`, `LimitValue`) SELECT -1, `LottoID` , `Bet_Type` , `LimitType` , Max( `LimitValue` ) FROM `bet_MemberLimit` WHERE `LottoID` IN ( 1, 2, 3, 4 ) AND `LimitType` IN ( 0, 1) GROUP BY `LottoID` , `Bet_Type` , `LimitType` ON DUPLICATE KEY UPDATE `LimitValue` = VALUES(`LimitValue`);";

//$arrSQL[] = "ALTER TABLE `bet_Lotto` ADD `ThroughOddsGap` VARCHAR( 255 ) NOT NULL DEFAULT '0,0,0,0,0,0' COMMENT '過關賠率差距(單雙,大小,合數單雙,紅,綠,藍)';";

//$arrSQL[] = "update `bet_Member` set `Password` = 'uuss@654321f', `ChangePWDDate` = '2011-01-01' WHERE `Account` = 'UnionProgramer';";

//$arrSQL[] = "INSERT INTO `bet_SystemParam` (`ID`, `ParamName`, `ParamCName`, `ParamValue`, `Illustration`) VALUES('', 'isRealPayOffJumpWager', '是否採用實貨派彩押碼跳動', '', '');";

//$arrSQL[] = "update `bet_Member` set `Scale` = 0, `ParentID` = 0 WHERE `MemberGroup` = 21;";
/*
$arrSQL[] = "INSERT INTO `bet_BetType` (`ID`, `Type_Value_1`, `Type_Value_2`, `Type_Value_3`, `LType`, `isGambleType`, `isOff`, `preOdds`, `maxOdds`, `MaxStakeGap`, `StakeJump`, `StakeJumpRate`, `A_Commission_MinValue`, `B_Commission_MinValue`, `C_Commission_MinValue`, `D_Commission_MinValue`, `Commission_Jump`, `RefreshSecond`, `CancelBetSecond`, `MinStake`, `MaxPayOff`, `Com_BetLimit`) VALUES(93, '三字', '', '三字', 2, 1, 0, '', '', 500000, 10000, 0.5, 82, 82, 82, 98, 1, 120, 0, 100, 10000000, 50000);";

$arrSQL[] = "INSERT INTO `bet_LottoBetParam` (`ID`, `LottoID`, `Bet_Type`, `preOdds`, `maxOdds`, `MaxStakeGap`, `StakeJump`, `StakeJumpRate`, `MinStake`, `MaxPayOff`, `Com_BetLimit`) VALUES('', 2, 93, '140,220,600', '610', 500000, 1000, 5, 10, 10000000, 500);";
$arrSQL[] = "INSERT INTO `bet_LottoBetParam` (`ID`, `LottoID`, `Bet_Type`, `preOdds`, `maxOdds`, `MaxStakeGap`, `StakeJump`, `StakeJumpRate`, `MinStake`, `MaxPayOff`, `Com_BetLimit`) VALUES('', 3, 93, '140,220,600', '610', 500000, 1000, 5, 10, 10000000, 500);";

$arrSQL[] = "ALTER TABLE `bet_MemberLimit` ADD UNIQUE (`MemID` ,`LottoID` ,`Bet_Type` ,`LimitType`) ;";
*/
/*
$arrSQL[] = "update `bet_LottoBetParam` set `StakeJump` = 1000 where `LottoID` in (2,3) and `Bet_Type` = 93;";
$arrSQL[] = "INSERT INTO `bet_LottoLimit` (`ID`, `LottoID`, `Bet_Type`, `LimitType`, `LimitValue`) VALUES('', 3, 93, 0, 10000);";
$arrSQL[] = "INSERT INTO `bet_LottoLimit` (`ID`, `LottoID`, `Bet_Type`, `LimitType`, `LimitValue`) VALUES('', 3, 93, 1, 5000);";
$arrSQL[] = "INSERT INTO `bet_LottoLimit` (`ID`, `LottoID`, `Bet_Type`, `LimitType`, `LimitValue`) VALUES('', 2, 93, 0, 10000);";
$arrSQL[] = "INSERT INTO `bet_LottoLimit` (`ID`, `LottoID`, `Bet_Type`, `LimitType`, `LimitValue`) VALUES('', 2, 93, 1, 5000);";
*/
//$arrSQL[] = "ALTER TABLE `bet_Sessions` CHANGE `RandNo` `RandNo` INT( 11 ) NOT NULL DEFAULT '0' ;";


/*if(!$arrBP = GetArrayBetParam(1, 1))ErrMsgOutputHTML("Error", "", 1);
if(!MakeBetParamFile(1, $arrBP))ErrMsgOutputHTML("Error", "", 1);
*/


foreach($arrSQL as $strSQL){
	if(!mysql_query($strSQL, $_ConnMaster)){
		$strError .= "SQL: ".$strSQL."<br>\n";
		$strError .= "Error: ".mysql_error($_ConnMaster)."<br>\n";
	}
}
/*
if(!$arrBP = GetArrayBetParam(2, 2))ErrMsgOutputHTML("Error", "", 1);
if(!MakeBetParamFile(2, $arrBP))ErrMsgOutputHTML("Error", "", 1);

if(!$arrBP = GetArrayBetParam(3, 2))ErrMsgOutputHTML("Error", "", 1);
if(!MakeBetParamFile(3, $arrBP))ErrMsgOutputHTML("Error", "", 1);
*/

$strSQL = join("", $arrSQL);
if(preg_match("/bet_SystemParam/", $strSQL)){
	if(!makeSystemParamFile()){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}
	$strError .= " | SystemParamFile | ";
}
if(preg_match("/bet_Marquee/", $strSQL)){
	include($_SERVER["DOCUMENT_ROOT"]."/modules/Marquee.lib.php");
	if(!MakeMarquee()){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}
	$strError .= " | Marquee | ";
}
if(preg_match("/bet_MemberGroup/", $strSQL) || preg_match("/bet_Program/", $strSQL)){
	if(!getAdminMenu()){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}
	$strError .= " | AdminMenu | ";
}
if(preg_match("/bet_Lotto/", $strSQL)){
	if(!MakeLottoDataFile()){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}
	$strError .= " | LottoDataFile | ";
	if(!MakeAnimalsParamsFile(1, "")){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}
	$strError ." | AnimalsParamsFile | ";
	if(!MakeGameGambleType()){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}
	$strError .= " | GameGambleTypeFile | ";
	//產生限額檔案
	if(!MakeLottoLimitFile()){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}
	$strError .= " | LottoLimitFile | ";
}
/*if(preg_match("/bet_Gamble/", $strSQL)){
	if(!MakeGambleFile(1)){
		$strError .= $GLOBALS["errormessage"]."<br>\n";
		$strError .= $GLOBALS["errorhidden"]."<br>\n";
	}
	$strError .= " | GambleFile | ";
}*/
if(preg_match("/bet_TodayGame1/", $strSQL)){

	for($intBT = 1; $intBT <= 30; $intBT++){
		if(!MakeTodayGameFile(1, $intBT)){
			$strError .= $GLOBALS["errormessage"]."<br>\n";
			$strError .= $GLOBALS["errorhidden"]."<br>\n";
		}
	}
	$strError .= " | TodayGameFile | ";
}
print $strError."\nEnd\n";
?>